/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package scrum;

import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;

/**
 *
 * @author jorgeraulgrion
 */
public class TextColorPanel extends javax.swing.JPanel{
    private float tran= 0.4f;
    private Color color1 = new Color(0,0,0);
    private Color color2 = new Color(0,0,0);
    String Letra = "Null";
    
    public TextColorPanel(){
        setOpaque(true);
    }
    

    public void paint(Graphics g) {
    
   Graphics2D g2 = (Graphics2D) g;
   g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
   Rectangle clip = g2.getClipBounds();                        
        
   AlphaComposite old = (AlphaComposite) g2.getComposite();
   g2.setComposite(AlphaComposite.SrcOver.derive(getTran()));
   g2.setPaint(new GradientPaint(0.7f, 0.7f, color1.brighter(),0.7f ,getHeight(), color2.brighter()));        
        g2.fillRect(clip.x, clip.y, clip.width, clip.height);  
   //super.paintComponent(g);
   //g2.setComposite(old);
        

    Dimension d = getSize();
    AffineTransform ct = AffineTransform.getTranslateInstance(d.width / 2,
        d.height * 3 / 4);
    g2.transform(ct);

    String s = Letra;
    Font f = new Font("Serif", Font.PLAIN, 55);
    g2.setFont(f);

    int count = 6; 
    for (int i = 1; i <= count; i++) {
      AffineTransform oldTransform = g2.getTransform();

      float ratio = (float) i / (float) count;
      g2.transform(AffineTransform.getRotateInstance(Math.PI
          * (ratio - 1.0f)));
      float alpha = ((i == count) ? .4f : ratio / 3);
      g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
          alpha));
      g2.drawString(s, 0, 0);

      g2.setTransform(oldTransform);
    }
    
    
   }
     
    public void SetLetra(String Letra){
        this.Letra=Letra;
    }
     public void setVistaColor(){        
        this.color1 = new Color(0,76,255);
        this.color2 = new Color(192,192,192);        
    }
     
       public void setVistaColor2(){        
        this.color1 = new Color(66,111,166);
        this.color2 = new Color(103,174,118);        
    }
     
     public float getTran() {
        return tran;
    }
}
